#include <iostream>
#include "list.h"
using namespace std;

namespace test
{

void test_list_1()
{
    list<int> lt;
    lt.push_front(1);
    lt.push_back(2);
    lt.push_back(3);
    lt.push_back(4);
    lt.print();

    lt.pop_front();
    lt.pop_back();
    lt.print();

    lt.clear();
    lt.print();

    lt.push_back(10);
    lt.push_back(20);
    lt.push_back(30);
    lt.print();

    list<int> lt2(lt);
    for (auto e : lt2)
    {
        cout << e << " ";
    }
    cout << endl;
}

void test_reverse_iterator()
{
    list<int> lt;
    lt.push_back(1);
    lt.push_back(2);
    lt.push_back(3);
    lt.push_back(4);

    list<int>::iterator it = lt.begin();
    while (it != lt.end())
    {
        cout << *it << " ";
        ++it;
    }
    cout << endl;

    list<int>::reverse_iterator rit = lt.rbegin();
    while (rit != lt.rend())
    {
        cout << *rit << " ";
        ++rit;
    }
    cout << endl;
}

}

int main()
{
    // test::test_list_1();
    // test_list_2();
    // test_list_3();
    test::test_reverse_iterator();

    return 0;
}